-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network Provider: Cloud subnets refactor #1545
Conversation
@dclarizio, would you please assign it, thanks |
@gildub unrecognized command 'label', ignoring... Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone |
@gildub Cannot apply the following label because they are not recognized: networkings |
@miq-bot add_label networks |
Test failure looks valid... |
@himdel, all green now. |
API.get("/api/cloud_subnets/" + cloudSubnetFormId + "?expand=resources&attributes=ext_management_system.name,cloud_tenant.name,cloud_network.name").then(function(data) { | ||
vm.cloudSubnetModel.name = data.name; | ||
vm.cloudSubnetModel.ems_name = data.ext_management_system.name; | ||
vm.cloudSubnetModel.tenant_name = angular.isDefined(data.cloud_tenant) ? data.cloud_tenant.name : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI we're trying to remove angular.isDefined
, this could be just data.cloud_tenant ? data.cloud_tenant.name : undefined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that was actually recommended recently, there are cases where the variable ends being undefined and would otherwise breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if you need to check for definedness, use data.cloud_tenant !== undefined
.
But since you just return undefined when cloud tenant is undefined, you don't need to check that.
This could also be written as data.cloud_tenant && data.cloud_tenant.name
.
Not sure the API is quite ready for this... I have 4 Network managers, choosing 2 of them gives me 0 tentants (that's probably OK), another one is fine, has tenants, and another one gives me...
After that, chosing the one with tenants and chosing a tenant and filling out a few field by random, I hit Save. .. and all I get is an error screen with So.. I'm guessing there's some validation missing? |
Oh.. saving is not done via the API, it's still using so .. the
The data that got sent on save was..
(I'm not sure these values are valid for those fields, but there's no validation, so I'll assume they are, or the server needs to return a better message :).) |
@@ -261,7 +225,7 @@ def new_form_params | |||
if params[:gateway] | |||
options[:gateway] = params[:gateway].blank? ? nil : params[:gateway] | |||
end | |||
options[:ip_version] = params[:network_protocol] | |||
options[:ip_version] = params[:network_protocol] =~ /4/ ? 4 : 6 | |||
options[:cloud_tenant] = find_record_with_rbac(CloudTenant, params[:cloud_tenant_id]) if params[:cloud_tenant_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. probably caused by missing from_cid
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, thanks.
This pull request is not mergeable. Please rebase and repush. |
@himdel, could you please re-review? Thanks |
@gildub Still missing that |
@himdel, I've rebased and re-tested again, the creation works fine, I'm not getting any issues or any missing |
@gildub Set your database to REGION other than zero and you will, sorry :). And yes, you need to use a REGION different than zero, otherwise you'll be missing Also, none of the other problems I mentioned are fixed, I'm still getting that And the tests are failing. Why am I even looking at this? |
@himdel, the problem(s) your mentioned aren't fixed because I couldn't reproduce it (or them) and because of lack of context/description. Also the tests are failing because an unrelated issue, and this is actually happening way too often maybe because we have cross repos dependencies. Now that said:
Cheers, PS: BTW, this is a re-factor! |
Ah, thanks for restarting :). Yes, I feel your pain, it's too often :).
Thanks.. if it helps, that problematic provider... Both providers I can see there are It looks like the important part is that for the failing one, I've created an issue, looks like an API bug.. ManageIQ/manageiq#15569
The only documentation I could find is http://manageiq.org/docs/guides/architecture/enterprise#region--enterprise . But a simple explanation is that region is a numerical prefix for all the ID values in the system. When creating a fresh database instead of importing an existing one, if a In region 0, In regions other than 0, any id will be usually shortened in the form of
Understood, but why not make things better than refactoring? :) Or, in this case, at least useable :). And as long as I can fill out all the fields, sucessfuly click submit, and only then get an error, the form is not quite user friendly. And when that error is a generic exception with If you want to split this into a purely-controllerAs-refactor PR, and a fix-the-bugs PR, feel free to :). |
Sorry I missed the support feature which was present for the delete case but for the create/update cases, I just added them. |
Test failure looks familiar, restarting travis :) |
vm.cloudSubnetModel.network_protocol = data.network_protocol; | ||
vm.afterGet = true; | ||
vm.modelCopy = angular.copy( vm.cloudSubnetModel ); | ||
}).catch(miqService.handleFailure); | ||
miqService.sparkleOff(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not belong here, should be inside that .then
function body.. Otherwise, there is no spinner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
controllerAs check:
|
Hey, added the checklist here as well, looks like you just removed the As for merging new&edit .. if this doesn't make sense to do in this PR, let me know, I can merge as is (except the scope thing). The same goes for object.assign - would be nice to solve this here, but if there is a reason not to... EDIT: but since you're doing changes anyway, I also notice the |
Replaces $scope with this Adds ng-cloak and form-change Removes obsolete miqrequire and so
I added back the missing Yes I would rather focus on the refactor only part here. Rest assured I'm going to work on merging edit/new and use Object.assign. Thanks |
Checked commits https://github.com/gildub/manageiq-ui-classic/compare/51d030caef282c2c49e5717f6474551db7803a62~...cd0b6e6f4ae0bc08dfd563504c5f75434591026d with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Thanks :) Merged.. but please do look into adding some validations here. |
@himdel, thanks, will do. |
@gildub Cannot apply the following label because they are not recognized: fine/yes bug |
The following PRs are taking care of the backport for Fine branch: Removing |
@gildub unrecognized command 'remove', ignoring... Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone |
Backported to Fine via #2320 |
Networks > Subnets > add/edit one
Replaces
$scope
withthis
Adds
ng-cloak
andform-change
Removes obsolete
miqrequire
Depends upon #1508
https://bugzilla.redhat.com/show_bug.cgi?id=1467725